<template>
	<view>
		<textarea v-model="con" placeholder="请输入求购内容" class="input-box" />
		<view class="footer">
			<view  class="up-btn" @click="upHand">发布</view>
			
		</view>
	</view>
</template>

<script>
	import API from '../../api/index.js'
	export default {
		data() {
			return {
				con:'',
				
			}
		},
		methods: {
			upHand () {
				if (uni.getStorageSync('userinfo').userInfo.nickName!='') {
				if (this.con=='') {
					uni.showToast({
						title:'内容不能为空',
						icon:'none'
					})
					return
				} else {
						var data = {
							desc :this.con
						}
						API.indexHome.publicBuy(data).then(res => {
							if (res.errno == '0') {
								uni.showToast({
									title: '发布成功',
									duration: 2000
								});
								setTimeout(()=>{
									wx.navigateBack()
								},2000)
								
							}
						})
					
				}
				} else {
					uni.navigateTo({
						url:'/pages/login/login'
					})
				}
			}
		}
	}
</script>

<style>
.input-box {
	width: 702rpx;
	height: 600rpx;
	background: #FFFFFF;
	border-radius: 20rpx;
	margin:20rpx auto;
	padding: 20rpx;
	box-sizing: border-box;
	font-size: 28rpx;
}
.prompt {
	line-height: 70rpx;
	font-size: 28rpx;
	color: #666666;
	margin-left: 24rpx;
}
.footer {
	
	width: 100%;
	margin-top: 90rpx;
}
.up-btn {
	width: 702rpx;
	height: 80rpx;
	background: #333333;
	border-radius: 40rpx;
	margin: 15rpx auto;
	color: #fff;
	font-size: 30rpx;
	color: #F6CB90;
	line-height: 80rpx;
	text-align: center;
}
.up-btn:active {
	opacity: 0.7;
}
</style>
